﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Jenvin.Library.Utils.Encryption;

namespace Jenvin.Library.Utils.Encryption
{
    public class HashFactory
    {
        public static IHash CreateMd5()
        {
            return new MD5Hash();
        }

        public static IHash CreateSha1()
        {
            return new SHA1Hash();
        }

        public static IHash Create(string name)
        {
            if (string.Compare(name, "md5", true) == 0)
                return new MD5Hash();
            if (string.Compare(name, "sha1", true) == 0)
                return new SHA1Hash();
            throw new ArgumentException("the name "+name+" doesn't recognize");
        }
    }
}
